<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<!--    <script language="javascript" type="text/javascript" src="My97DatePicker/My97DatePicker/WdatePicker.js"></script>-->
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
    <script>
        function login(){
            let account=document.getElementById("account").value.trim()
            let password=document.getElementById("password").value.trim()
            if (account == ""){
                document.getElementById("showTipMsgAccount").innerText = "*必填";
                return;
            }
            if (password == ""){
                document.getElementById("showTipMsg").innerText = "*必填";
                return;
            }
            $.ajax({
                url:"user/login",
                data:{
                    account:account,
                    password:password
                },

                method:"post",
                success:function (res){

                    if (res== "N"){
                        alert("账号或密码错误,请重试!");
                        return;
                    }
                    window.location.href = "main.html";
                }
            })

        }


    </script>
</head>
<body>
<div class="body" style=" width:100%; height:585px; overflow:hidden; position:absolute; top:47px;">
    <div class="logintitle" style="text-align: center;font-size: 25px">
        <span>登录页面</span>
    </div>
    <div class="loginbody" style="text-align: center;">
        账号：<input type="text" id="account" placeholder="账号">

        <span id="showTipMsgAccount" style="color: red;font-size: 12px"></span><br>

        密码：<input type="password" id="password" placeholder="密码">

        <span id="showTipMsg" style="color: red;font-size: 12px"></span><br>

    </div>
    <div class="loginbutton" style="text-align: center;margin-top: 30px">
        <button type="button" class="btn btn-primary" onclick="login()">登录</button>
        <button type="reset" class="btn btn-danger" >重置</button><br>

    </div>
    <div class="registbody" style="text-align: center;margin-top: 30px"><a href="regist.html">没有账号？去注册！</a></div>

</div>
</body>
</html>